<?php
$this->pageTitle=Yii::app()->name . ' - Đăng ký thành viên';
$this->breadcrumbs = array(
	
);
?>
<div class="well">
	<div class="navbar">
		<div class="navbar-inner"><i class="icon-chevron-right icon-white"></i> Đăng ký thành viên</div>
	</div>
	<div class="row-fluid">
		 <?php
    $form=$this->beginWidget('CActiveForm', array(
    'id'=>'user-form',
    'enableAjaxValidation'=>true,
    'htmlOptions'=>array('class'=>'form-horizontal','enctype' => 'multipart/form-data'),
  )); 
    ?>
			<p class="note">Những trường đánh dấu <span class="required">*</span> là trường bắt buộc.</p>
			<?php echo $form->errorSummary(array($model,$profile),"","",array('class'=>'alert alert-error')); ?>
			<fieldset>
	    <legend>Thông tin tài khoản</legend>
		    <div class="control-group">
		      <?php echo $form->labelEx($model,'username',array('class'=>'control-label')); ?>
	        <?php echo $form->textField($model,'username',array('autocomplete'=>'off','required'=>'required')); ?>    
		   	</div>
		  
		    <div class="control-group">
		      <?php echo $form->labelEx($model,'password',array('class'=>'control-label')); ?>
          <?php echo $form->passwordField($model,'password',array('autocomplete'=>'off','required'=>'required')); ?>    
        </div>
		    
		    <div class="control-group">
		      <?php echo $form->labelEx($model,'repass',array('class'=>'control-label')); ?>
     	    <?php echo $form->passwordField($model,'repass',array('autocomplete'=>'off','required'=>'required')); ?>    
	      </div>
	      
	      <div class="control-group">
		      <?php echo $form->labelEx($profile,'email',array('class'=>'control-label')); ?>
          <?php echo $form->textField($profile,'email',array('autocomplete'=>'off','required'=>'required'))?>    
		   	</div>
	  	</fieldset>
	  	
	  	<fieldset>
	    <legend>Thông tin cá nhân</legend>
		    <div class="control-group">
		      <?php echo $form->labelEx($profile,'fullname',array('class'=>'control-label')); ?>
          <?php echo $form->textField($profile,'fullname',array('autocomplete'=>'off','required'=>'required'))?>    
		   	</div>
		  
		    <div class="control-group">
					<?php echo $form->labelEx($profile,'avatar',array('class'=>'control-label')); ?>
          <?php echo $form->fileField($profile,'avatar')?>
				</div>
				
		    <div class="control-group">
		      <?php echo $form->labelEx($profile,'dateofbirth',array('class'=>'control-label')); ?>
          <?php echo $form->textField($profile,'dateofbirth', array('readonly'=>'readonly','autocomplete'=>'off','class'=>'datepicker'))?>    
	      </div>
	      
	      <div class="control-group">
		      <?php echo $form->labelEx($profile,'gender',array('class'=>'control-label')); ?>
		      <div class="gender">
		      <?php echo $form->radioButtonList($profile,'gender',array('1'=>'Nam','0'=>'Nữ'), array('separator'=>'',
        		'template'=>'{input}{label}')) ?>
		      </div>	    
		   	</div>
		   	
		   	<div class="control-group">
		      <?php echo $form->labelEx($profile,'phone',array('class'=>'control-label')); ?>
          <?php echo $form->textField($profile,'phone',array('autocomplete'=>'off'))?>    
		   	</div>
		   	
		   	<div class="control-group">
		      <?php echo $form->labelEx($profile,'city',array('class'=>'control-label')); ?>
		       <?php echo $form->dropDownList($profile,'city',$profile->getCity(),array('prompt'=>'Chọn thành phố/tỉnh')); ?>	    
		   	</div>
		   	
		   	<div class="control-group">
		      <?php echo $form->labelEx($profile,'school',array('class'=>'control-label')); ?>
          <?php echo $form->textField($profile,'school',array('autocomplete'=>'off'))?>    
		   	</div>
	  	</fieldset>
	  	<?php if(CCaptcha::checkRequirements()) { ?>
      <div class="control-group clearfix">
        <?php echo $form->labelEx($profile,'captcha',array('class'=>'control-label')); ?>
        <div class="captcha">
        <?php $this->widget('CCaptcha', array(
            'buttonLabel'=>'<i class="icon-refresh"></i>',
            'clickableImage'=>true,
        		'imageOptions'=>array('id'=>'img_captcha')
        )); ?>
        <?php echo $form->textField($profile,'captcha', array('autocomplete'=>'off','required'=>'required')); ?>
        </div>
        <div class="hint">
        	Vui lòng nhập những ký tự ở hình bên trên. <br>
        	Không phân biệt chữ hoa chữ thường.
        </div>
      </div>
      <?php } ?>
			<?php echo CHtml::submitButton('Đăng ký', array('class'=>'btn btn-success')); ?>
		<?php $this->endWidget(); ?>
	</div>
</div>
<script type="text/javascript">
var d=new Date();
var now = d.getFullYear();
var past = d.getFullYear()-90;
var range = past+":"+now;
$(function() {
	$(window).load(function(){
		$("#img_captcha").trigger("click");
	});
  $(".datepicker").datepicker({
  	dateFormat: 'dd-mm-yy',
    changeMonth: true,
    changeYear: true,
    yearRange: range,
    dayNamesMin: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
  });
});
</script>